"""
数据库模型文件
"""

from .database import Base


class Item(Base):
    __tablename__ = "items"

    id = Column(Integer, primary_key=True, index=True)
    mtype = Column(String)  # 记录类似：answer 表示客户端发过来的，response 表示 服务器返回
    session_id = Column(String)
    msg = Column(String, index=True)

    def to_dict(self):
        return {c.name: getattr(self, c.name) for c in self.__table__.columns}